﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace iTunesAutomator
{
    public static class ExtensionMethods
    {
        public static void AppendStatus(this RichTextBox textBox, string text)
        {
            if (textBox.Text.Length > 0)
            {
                textBox.AppendText(Environment.NewLine);
            }
            textBox.AppendText(text);
        }

        public static void AppendStatus(this RichTextBox textBox, string text, Color color)
        {
            if (textBox.Text.Length > 0)
            {
                textBox.AppendText(Environment.NewLine);
            }
            textBox.SelectionStart = textBox.TextLength;
            textBox.SelectionLength = 0;
            textBox.SelectionColor = color;
            textBox.AppendText(text);
            textBox.SelectionColor = textBox.ForeColor;
            textBox.ScrollToCaret();
        }    
    }
}
